package com.swak.job;

import java.util.List;

import com.swak.utils.Lists;

import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

/**
 * 任务分发
 * 
 * @author DELL
 */
@Getter
@Setter
@Accessors(chain = true)
public class JobFragments {

	/**
	 * 任务
	 */
	private final Job job;

	/**
	 * 任务 - 调度
	 */
	private final JobDispatch dispatch;

	/**
	 * 此任务的执行器数量
	 */
	private final int fragments;

	/**
	 * 每个分片的配置参数， 可以自定义需要多少个执行器来执行
	 */
	private List<String> configs = Lists.newArrayList();

	public JobFragments(Job job, JobDispatch dispatch, int fragments) {
		this.job = job;
		this.dispatch = dispatch;
		this.fragments = fragments;
	}

	public JobFragments addConfig(String config) {
		configs.add(config);
		return this;
	}
}
